fsUsrCNID = 16, /* First assignable directory or file number */
/* File system trap word attribute bits */
kHFSBit = 9, /* HFS call: bit 9 */
kHFSMask = 0x0200,
kAsyncBit = 10, /* Asynchronous call: bit 10 */
kAsyncMask = 0x0400
};
/*
* HFSCIProc selectCode values
* Note: The trap attribute bits (the HFS bit and the asynchronous bit)
* may be set in these selectCode values.
*/
enum {
kFSMOpen = 0xA000,
kFSMClose = 0xA001,
kFSMRead = 0xA002,
kFSMWrite = 0xA003,
kFSMGetVolInfo = 0xA007,
kFSMCreate = 0xA008,
kFSMDelete = 0xA009,
kFSMOpenRF = 0xA00A,
kFSMRename = 0xA00B,
kFSMGetFileInfo = 0xA00C,
kFSMSetFileInfo = 0xA00D,
kFSMUnmountVol = 0xA00E,
kFSMMountVol = 0xA00F,
kFSMAllocate = 0xA010,
kFSMGetEOF = 0xA011,
kFSMSetEOF = 0xA012,
kFSMFlushVol = 0xA013,
kFSMGetVol = 0xA014,
kFSMSetVol = 0xA015,
kFSMEject = 0xA017,
kFSMGetFPos = 0xA018,
kFSMOffline = 0xA035,
kFSMSetFilLock = 0xA041,
kFSMRstFilLock = 0xA042,
kFSMSetFilType = 0xA043,
kFSMSetFPos = 0xA044,
kFSMFlushFile = 0xA045, /* The File System HFSDispatch selectCodes */
kFSMOpenWD = 0x0001,
kFSMCloseWD = 0x0002,
kFSMCatMove = 0x0005,
kFSMDirCreate = 0x0006,
kFSMGetWDInfo = 0x0007,
kFSMGetFCBInfo = 0x0008,
kFSMGetCatInfo = 0x0009,
kFSMSetCatInfo = 0x000A,
kFSMSetVolInfo = 0x000B,
kFSMLockRng = 0x0010,
kFSMUnlockRng = 0x0011,
kFSMCreateFileIDRef = 0x0014,
kFSMDeleteFileIDRef = 0x0015,
kFSMResolveFileIDRef = 0x0016,
kFSMExchangeFiles = 0x0017,
kFSMCatSearch = 0x0018,
kFSMOpenDF = 0x001A,
kFSMMakeFSSpec = 0x001B, /* The Desktop Manager HFSDispatch selectCodes */
kFSMDTGetPath = 0x0020,
kFSMDTCloseDown = 0x0021,
kFSMDTAddIcon = 0x0022,
kFSMDTGetIcon = 0x0023,
kFSMDTGetIconInfo = 0x0024,
kFSMDTAddAPPL = 0x0025,
kFSMDTRemoveAPPL = 0x0026,
kFSMDTGetAPPL = 0x0027,
kFSMDTSetComment = 0x0028,
kFSMDTRemoveComment = 0x0029,
kFSMDTGetComment = 0x002A,
kFSMDTFlush = 0x002B,
kFSMDTReset = 0x002C,
kFSMDTGetInfo = 0x002D,
kFSMDTOpenInform = 0x002E,
kFSMDTDelete = 0x002F, /* The AppleShare HFSDispatch selectCodes */
kFSMGetVolParms = 0x0030,
kFSMGetLogInInfo = 0x0031,
kFSMGetDirAccess = 0x0032,
kFSMSetDirAccess = 0x0033,
kFSMMapID = 0x0034,
kFSMMapName = 0x0035,
kFSMCopyFile = 0x0036,
kFSMMoveRename = 0x0037,
kFSMOpenDeny = 0x0038,
kFSMOpenRFDeny = 0x0039,
kFSMGetXCatInfo = 0x003A,
kFSMGetVolMountInfoSize = 0x003F,
kFSMGetVolMountInfo = 0x0040,
kFSMVolumeMount = 0x0041,
kFSMShare = 0x0042,
kFSMUnShare = 0x0043,
kFSMGetUGEntry = 0x0044,
kFSMGetForeignPrivs = 0x0060,
kFSMSetForeignPrivs = 0x0061
};
/*
* UTDetermineVol status values
*/
enum {
dtmvError = 0, /* param error */
dtmvFullPathame = 1, /* determined by full pathname */
dtmvVRefNum = 2, /* determined by volume refNum */
dtmvWDRefNum = 3, /* determined by working directory refNum */
dtmvDriveNum = 4, /* determined by drive number */
dtmvDefault = 5 /* determined by default volume */
};
/*
* UTGetBlock options
*/
enum {
gbDefault = 0, /* default value - read if not found */
/* bits and masks */
gbReadBit = 0, /* read block from disk (forced read) */
gbReadMask = 0x0001,
gbExistBit = 1, /* get existing cache block */
gbExistMask = 0x0002,
gbNoReadBit = 2, /* don't read block from disk if not found in cache */
gbNoReadMask = 0x0004,
gbReleaseBit = 3, /* release block immediately after GetBlock */
gbReleaseMask = 0x0008
};
/*
* UTReleaseBlock options
*/
enum {
rbDefault = 0, /* default value - just mark the buffer not in-use */
/* bits and masks */
rbWriteBit = 0, /* force write buffer to disk */
rbWriteMask = 0x0001,
rbTrashBit = 1, /* trash buffer contents after release */
rbTrashMask = 0x0002,
rbDirtyBit = 2, /* mark buffer dirty */
rbDirtyMask = 0x0004,
rbFreeBit = 3, /* free the buffer (save in the hash) */
rbFreeMask = 0x000A /* rbFreeMask (rbFreeBit + rbTrashBit) works as rbTrash on < System 7.0 RamCache; on >= System 7.0, rbfreeMask overrides rbTrash */
};
/*
* UTFlushCache options
*/
enum {
fcDefault = 0, /* default value - just flush any dirty buffers */
/* bits and masks */
fcTrashBit = 1, /* trash buffers after flushing */
fcTrashMask = 0x0002,
fcFreeBit = 3, /* free buffers after flushing */
fcFreeMask = 0x0008 /* fcFreeMask works as fcTrash on < System 7.0 RamCache */
};
/*
* UTCacheReadIP and UTCacheWriteIP cacheOption
*/
enum {
noCacheBit = 5, /* don't cache this please */
noCacheMask = 0x0020,
rdVerifyBit = 6, /* read verify */
rdVerifyMask = 0x0040
};
/*
* Cache routine internal error codes
*/
enum {
chNoBuf = 1, /* no free cache buffers (all in use) */
chInUse = 2, /* requested block in use */
chnotfound = 3, /* requested block not found */
chNotInUse = 4 /* block being released was not in use */
};
/*
* FCBRec.fcbFlags bits
*/
enum {
fcbWriteBit = 0, /* Data can be written to this file */
fcbWriteMask = 0x01,
fcbResourceBit = 1, /* This file is a resource fork */
fcbResourceMask = 0x02,
fcbWriteLockedBit = 2, /* File has a locked byte range */
fcbWriteLockedMask = 0x04,
fcbSharedWriteBit = 4, /* File is open for shared write access */
fcbSharedWriteMask = 0x10,
fcbFileLockedBit = 5, /* File is locked (write-protected) */
fcbFileLockedMask = 0x20,
fcbOwnClumpBit = 6, /* File has clump size specified in FCB */
fcbOwnClumpMask = 0x40,
fcbModifiedBit = 7, /* File has changed since it was last flushed */
fcbModifiedMask = 0x80
};
/*
* ExtFileProc options
*/
enum {
extendFileAllBit = 0, /* allocate all requested bytes or none */
extendFileAllMask = 0x0001,
extendFileContigBit = 1, /* force contiguous allocation */
extendFileContigMask = 0x0002
};
/*
* HFS Component Interface constants
*/
/*
* compInterfMask bits specific to HFS component
*/
enum {
hfsCIDoesHFSBit = 23, /* set if file system supports HFS calls */
hfsCIDoesHFSMask = 0x00800000,
hfsCIDoesAppleShareBit = 22, /* set if AppleShare calls supported */
hfsCIDoesAppleShareMask = 0x00400000,
hfsCIDoesDeskTopBit = 21, /* set if Desktop Database calls supported */
hfsCIDoesDeskTopMask = 0x00200000,
hfsCIDoesDynamicLoadBit = 20, /* set if dynamically loading code resource */
diCIUserCancelErr = 1, /* user cancelled the disk init */
diCICriticalSectorBadErr = 20, /* critical sectors are bad (hopeless) */
diCISparingFailedErr = 21, /* disk cannot be spared */
diCITooManyBadSectorsErr = 22, /* too many bad sectors */
diCIUnknownVolTypeErr = 23, /* the volume type passed in diCIExtendedZero paramBlock is not supported */
diCIVolSizeMismatchErr = 24, /* specified volume size doesn't match with formatted disk size */
diCIUnknownDICallErr = 25, /* bogus DI function call selector */
diCINoSparingErr = 26, /* disk is bad but the target FS doesn't do disk sparing */
diCINoExtendInfoErr = 27, /* missing file system specific extra parameter in diCIExtendedZero call */
diCINoMessageTextErr = 28 /* missing message text in DIReformat call */
};
/*
* File System Manager constants
*/
/*
* Miscellaneous constants used by FSM
*/
enum {
fsdVersion1 = 1, /* current version of FSD record */
fsmIgnoreFSID = 0xFFFE, /* this FSID should be ignored by the driver */
fsmGenericFSID = 0xFFFF /* unknown foreign file system ID */
};
/*
* compInterfMask bits common to all FSM components
*/
enum {
fsmComponentEnableBit = 31, /* set if FSM component interface is enabled */
fsmComponentEnableMask = 0x80000000,
fsmComponentBusyBit = 30, /* set if FSM component interface is busy */
fsmComponentBusyMask = 0x40000000
};
/*
* Selectors for GetFSInfo
*/
enum {
fsmGetFSInfoByIndex = -1, /* get fs info by index */
fsmGetFSInfoByFSID = 0, /* get fs info by FSID */
fsmGetFSInfoByRefNum = 1 /* get fs info by file/vol refnum */
};
/*
* InformFSM messages
*/
enum {
fsmNopMessage = 0, /* nop */
fsmDrvQElChangedMessage = 1, /* DQE has changed */
fsmGetFSIconMessage = 2 /* Get FFS's disk icon */
};
/*
* Messages passed to the fileSystemCommProc
*/
enum {
ffsNopMessage = 0, /* nop, should always return noErr */
ffsGetIconMessage = 1, /* return disk icon and mask */
ffsIDDiskMessage = 2, /* identify the about-to-be-mounted volume */
ffsLoadMessage = 3, /* load in the FFS */
ffsUnloadMessage = 4, /* unload the FFS */
ffsIDVolMountMessage = 5, /* identify a VolMountInfo record */
ffsInformMessage = 6, /* FFS defined message */
ffsGetIconInfoMessage = 7
};
/*
* Error codes from FSM functions
*/
enum {
fsmFFSNotFoundErr = -431, /* Foreign File system does not exist - new Pack2 could return this error too */
fsmBusyFFSErr = -432, /* File system is busy, cannot be removed */
fsmBadFFSNameErr = -433, /* Name length not 1 <= length <= 31 */
fsmBadFSDLenErr = -434, /* FSD size incompatible with current FSM vers */
fsmDuplicateFSIDErr = -435, /* FSID already exists on InstallFS */
fsmBadFSDVersionErr = -436, /* FSM version incompatible with FSD */
fsmNoAlternateStackErr = -437, /* no alternate stack for HFS CI */
fsmUnknownFSMMessageErr = -438 /* unknown message passed to FSM */
};
/*
* HFS Utility routine records
*/
/*
* record used by UTGetPathComponentName
*/
struct ParsePathRec {
StringPtr namePtr; /* pathname to parse */
short startOffset; /* where to start parsing */
short componentLength; /* the length of the pathname component parsed */
SignedByte moreName; /* non-zero if there are more components after this one */
SignedByte foundDelimiter; /* non-zero if parsing stopped because a colon (:) delimiter was found */
};
typedef struct ParsePathRec ParsePathRec;
typedef ParsePathRec *ParsePathRecPtr;
struct WDCBRec {
VCBPtr wdVCBPtr; /* Pointer to VCB of this working directory */
long wdDirID; /* Directory ID number of this working directory */
long wdCatHint; /* Hint for finding this working directory */
long wdProcID; /* Process that created this working directory */
};
typedef struct WDCBRec WDCBRec;
typedef WDCBRec *WDCBRecPtr;
struct FCBRec {
unsigned long fcbFlNm; /* FCB file number. Non-zero marks FCB used */
SignedByte fcbFlags; /* FCB flags */
SignedByte fcbTypByt; /* File type byte */
unsigned short fcbSBlk; /* File start block (in alloc size blks) */
unsigned long fcbEOF; /* Logical length or EOF in bytes */
unsigned long fcbPLen; /* Physical file length in bytes */
unsigned long fcbCrPs; /* Current position within file */
VCBPtr fcbVPtr; /* Pointer to the corresponding VCB */
Ptr fcbBfAdr; /* File's buffer address */
unsigned short fcbFlPos; /* Directory block this file is in */
/* FCB Extensions for HFS */
unsigned long fcbClmpSize; /* Number of bytes per clump */
Ptr fcbBTCBPtr; /* Pointer to B*-Tree control block for file */
unsigned long fcbExtRec[3]; /* First 3 file extents */
OSType fcbFType; /* File's 4 Finder Type bytes */
unsigned long fcbCatPos; /* Catalog hint for use on Close */
unsigned long fcbDirID; /* Parent Directory ID */
Str31 fcbCName; /* CName of open file */
};
typedef struct FCBRec FCBRec;
typedef FCBRec *FCBRecPtr;
/*
* HFS Component Interface records
*/
typedef pascal OSErr (*Lg2PhysProcPtr)(void *fsdGlobalPtr, VCBPtr volCtrlBlockPtr, FCBRecPtr fileCtrlBlockPtr, short fileRefNum, unsigned long filePosition, unsigned long reqCount, unsigned long *volOffset, unsigned long *contiguousBytes);
extern pascal OSErr UTTrashFileBlocks(VCBPtr volCtrlBlockPtr, unsigned long fileNum)
TWOWORDINLINE(0x7025, 0xA824);
extern pascal OSErr UTTrashBlocks(unsigned long beginPosition, unsigned long byteCount, VCBPtr volCtrlBlockPtr, short fileRefNum, short tbOption)
TWOWORDINLINE(0x7026, 0xA824);
extern pascal OSErr UTCacheReadIP(void *log2PhyProc, unsigned long filePosition, Ptr ioBuffer, short fileRefNum, unsigned long reqCount, unsigned long *actCount, short cacheOption)
TWOWORDINLINE(0x7027, 0xA824);
extern pascal OSErr UTCacheWriteIP(void *log2PhyProc, unsigned long filePosition, Ptr ioBuffer, short fileRefNum, unsigned long reqCount, unsigned long *actCount, short cacheOption)
TWOWORDINLINE(0x7028, 0xA824);
extern pascal OSErr UTBlockInFQHashP(short vRefNum, unsigned long diskBlock)
TWOWORDINLINE(0x702C, 0xA824);
/*
* File System Manager call prototypes
*/
extern pascal OSErr InstallFS(FSDRecPtr fsdPtr);
extern pascal OSErr RemoveFS(short fsid);
extern pascal OSErr SetFSInfo(short fsid, short bufSize, FSDRecPtr fsdPtr);
extern pascal OSErr GetFSInfo(short selector, short key, short *bufSize, FSDRecPtr fsdPtr);